/**
 * 
 */
package cc3002;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

/**
 * JUnit Test class : MysteriousSandwich
 * -------------------------------------
 * Testing Mysterious Sandwich extending WeirdFood.
 * @author Anibal Llanos Prado
 *
 */
public class MysteriousSandwichTest extends WeirdFoodTest{

	/**
	 * Setup. Fixtures are inherited.
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		bites=5;
		food1=new MysteriousSandwich();
		food2=new MysteriousSandwich();
	}

	/**
	 * Test method for {@link cc3002.MysteriousSandwich#bite(cc3002.HealthState)}.
	 * In this case, it's almost impossible to test this method because of the random multiplier.
	 * The only thing we can do is to check that the calories given are always inside certain
	 * limits during a controlled iteration (we will use 20 iterations in this test).
	 */
	@Test
	public void testBite() {
		for(int i=0; i<20; ++i){
			food1=new MysteriousSandwich();
			food1.setCalories(10);
			int bi=food1.bite(new HealthState());
			assertTrue(bi <= 30);
			assertTrue(bi >= -10);
		}
	}

	/**
	 * Test method for {@link cc3002.WeirdFood#setCalories(int)}.
	 * Same problem here.
	 */
	@Test
	public void testSetCalories() {
		food1.setCalories(10);
		int bi=food1.bite(new HealthState());
		assertTrue(bi >= -10 && bi <= 30);
	}

	/**
	 * Test method for {@link cc3002.WeirdFood#modifyHealth(cc3002.HealthState)}.
	 */
	@Test
	public void testModifyHealth() {
		super.testModifyHealth();
	}

	/**
	 * Test method for {@link cc3002.Food#setName(java.lang.String)}.
	 */
	@Test
	public void testSetName() {
		super.testSetName();
	}

}
